<template>
	<view class="bgView" :style="[{height:TopHeight + 'px'}]">
		<view class="barView" :style="[{height:statusBarHeight+'px',marginTop:barHeight+'px'}]">
			<view class="leftView">
				<view class="sonView">
					<view style="display: flex;flex: 1;align-items: center;justify-content: center;" @click="backHandle">
						<u-icon name="arrow-left" color="#1F2023" size="28"></u-icon>
					</view>
					<view style="height: 20px;background-color: #E9E9E9;width: 1px;margin-top: 7px;"></view>
					<view style="display: flex;flex: 1;align-items: center;justify-content: center;" @click="homeHandle">
						<u-icon name="home-fill" color="#1F2023" size="28"></u-icon>
					</view>
				</view>
			</view>
			<view class="centerView">
				{{title}}
			</view>
			<!-- <slot name="right"></slot> -->
			<view class="rightView"></view>
		</view>
	</view>
</template>

<script>
	export default{
		name:'zhyq_cell',
		data(){
			return {
				CustomBar: 0,//this.$statusBarHeight
				TopHeight:0,
				statusBarHeight:0,
				barHeight:0
			}
		},
		props:{
			leftIcon:{
				type: String,
				default:'/static/img/zhyq/ic_renlianluru.png'
			},
			title:{
				type: String,
				default:''
			}
		},
		mounted() {
			uni.getSystemInfo({success: (e) => {
				this.StatusBar = e.statusBarHeight;
				let custom = wx.getMenuButtonBoundingClientRect();
				this.statusBarHeight = e.statusBarHeight;
				this.barHeight = custom.top;
				this.CustomBar = custom.bottom + custom.top - e.statusBarHeight;
				this.TopHeight = this.CustomBar;//this.StatusBar+this.CustomBar;
			}})
		},
		methods:{
			handle(){
				this.$emit('click')
			},
			backHandle(){
				uni.navigateBack({
					delta:1
				})
				this.$emit('backHandle')
			},
			homeHandle(){
				uni.switchTab({
					url: '/pages/home/home'
				})
				this.$emit('backHandle')
			}
		}
	}
</script>

<style lang="scss" scoped>
	.bgView{
		width: 100vw;
		background-color: white;
		display: flex;
		flex-direction: column;
		justify-content: flex-end;
	}
	.barView{
		width: 100vw;
		// background-color: red;
		display: flex;
		flex-direction: row;
		align-items: center;
		margin-bottom: 4px;
		// justify-content: space-between;
	}
	.leftView{
		flex: 1;
		.sonView{
			width: 81px;
			height: 30px;
			border: 0.5px solid #E9E9E9;
			border-radius: 16px;
			margin-left: 16px;
			display: flex;
			flex-direction: row;
		}
	}
	.centerView{
		display: flex;
		flex: 1;
		align-items: center;
		justify-content: center;
		color: #000000;
		font-size: 16px;
		font-weight: bold;
		line-height: 19px;
		text-align: center;
	}
	.rightView{
		display: flex;
		flex: 1;
	}
</style>